export default {
	init: (page) => {
		return new Vue({
			el: '#page_friends_list',
			methods: {
				onItemTap: function(item) {
					myApp.showIndicator();
					this.$http.post(`friends/${item.id}`, {settting: true}, {auth: false}).then((res) => {
						let follow = res.data;
						mainView.loadPage({
							url: 'views/friends/detail/detail.html',
							context: {follow}
						});
						myApp.hideIndicator();
					}, (err) => {
						myApp.hideIndicator();
						if (err) {
							console.log(error.stack);
						}
					});
				}
			},
			data: {
				items: []
			},
			ready: function() {
				myApp.showIndicator();
				this.$http.post('friends', {set: true}, {auth: true}).then((res) => {
					// console.log("res-->", res);
					setTimeout(() => {
						this.items = res.data;
						myApp.hideIndicator();
					}, 500);
				}, (res) => {
					myApp.hideIndicator();
				});
			}
		});
	}
};